import config
from . import xf, paddle, vcode, vslide, tencent
from .. import constants
# 讯飞印刷体 OCR 识别器
xfOcrRecognizer = xf.OcrRecognizer ()
# 讯飞通用 OCR 识别器
xfPublicOcrRecognizer = xf.PublicOcrRecognizer ()
# 讯飞手写 OCR 识别器
xfHandwritingOcrRecognizer = xf.HandwritingOcrRecognizer ()
# 讯飞物体识别器
xfCurrencyRecognizer = xf.CurrencyRecognizer ()
# 讯飞场所识别器
xfPlaceRecognizer = xf.PlaceRecognizer ()
# 讯飞场景识别器
xfSceneRecognizer = xf.SceneRecognizer ()
# paddle OCR 识别器
paddleEnabcOcrRecognizer = paddle.PaddleOcrRecognizer (paddle.URL_ENABC)
paddleZxrjyOcrRecognizer = paddle.PaddleOcrRecognizer (paddle.URL_ZXRJY)
localPaddleOcrRecognizer = paddle.LocalPaddleOcrRecognizer ()
# 腾讯云通用 OCR 识别器
tencentOcrRecognizer = tencent.TencentOcrRecognizer()
# 验证码识别器
vCodeRecognizer = vcode.VCodeRecognizer ()
# 滑块验证识别器
vSlideRecognizer = vslide.VSlideRecognizer ()
def getOcrRecognizer ():
    defaultRecognizer = config.conf[constants.OCR]['defaultRecognizer']
    if defaultRecognizer == 1:
        return xfHandwritingOcrRecognizer
    if defaultRecognizer == 2:
        return xfPublicOcrRecognizer
    if defaultRecognizer == 3:
        return tencentOcrRecognizer
    if defaultRecognizer == 4:
        return paddleEnabcOcrRecognizer
    if defaultRecognizer == 5:
        return paddleZxrjyOcrRecognizer
    if defaultRecognizer == 6:
        return localPaddleOcrRecognizer
    return xfOcrRecognizer
def getOcrRecognizerNames ():
    return ['讯飞印刷体文字识别器', '讯飞手写文字识别器', '讯飞通用文字识别器', '腾讯云通用文字识别器', 'Paddle 文字识别器（Enabc 提供）', 'Paddle 文字识别器（Zxrjy 提供）', '本地 Paddle 文字识别器']